package com.tjvib.adapter;

import android.content.Context;
import android.widget.CheckBox;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.tjvib.R;
import com.tjvib.bean.BLEDevice;
import com.tjvib.bean.SensorSelect;

import java.util.List;

public class SensorSelectAdapter extends BaseQuickAdapter<SensorSelect, BaseViewHolder> {

    private Context context;
    private List<SensorSelect> sensorSelectList;

    public SensorSelectAdapter(int layoutResId, Context context, @Nullable List<SensorSelect> data) {
        super(layoutResId, data);
        this.context = context;
        this.sensorSelectList = data;
    }

    @Override
    protected void convert(@NonNull BaseViewHolder baseViewHolder, SensorSelect sensorSelect) {
        baseViewHolder.setText(R.id.item_lpmsb2_sel_tv_name, sensorSelect.getName())
                .setText(R.id.item_lpmsb2_sel_tv_add, sensorSelect.getAddress());

        baseViewHolder.findView(R.id.item_lpmsb2_sel_tv_status).setBackgroundColor(
                context.getResources().getColor(sensorSelect.isSelected() ? R.color.green : R.color.main_grey_0));
    }
}
